﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiRasterImageDesc : OdGiRasterImageParam
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiRasterImageDesc(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiRasterImageDesc_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiRasterImageDesc obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiRasterImageDesc()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiRasterImageDesc(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public static OdGiRasterImage createObject(uint pixelWidth, uint pixelHeight, OdGiRasterImage.Units units, double xPelsPerUnit, double yPelsPerUnit)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiRasterImageDesc_createObject__SWIG_0(pixelWidth, pixelHeight, (int)units, xPelsPerUnit, yPelsPerUnit);
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiRasterImage createObject(uint pixelWidth, uint pixelHeight, OdGiRasterImage.Units units, double xPelsPerUnit)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiRasterImageDesc_createObject__SWIG_1(pixelWidth, pixelHeight, (int)units, xPelsPerUnit);
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiRasterImage createObject(uint pixelWidth, uint pixelHeight, OdGiRasterImage.Units units)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiRasterImageDesc_createObject__SWIG_2(pixelWidth, pixelHeight, (int)units);
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiRasterImage createObject(uint pixelWidth, uint pixelHeight)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiRasterImageDesc_createObject__SWIG_3(pixelWidth, pixelHeight);
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiRasterImage createObject(uint pixelWidth, uint pixelHeight, uint colorDepth, OdGiRasterImage.Units units, double xPelsPerUnit, double yPelsPerUnit)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiRasterImageDesc_createObject__SWIG_4(pixelWidth, pixelHeight, colorDepth, (int)units, xPelsPerUnit, yPelsPerUnit);
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiRasterImage createObject(uint pixelWidth, uint pixelHeight, uint colorDepth, OdGiRasterImage.Units units, double xPelsPerUnit)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiRasterImageDesc_createObject__SWIG_5(pixelWidth, pixelHeight, colorDepth, (int)units, xPelsPerUnit);
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiRasterImage createObject(uint pixelWidth, uint pixelHeight, uint colorDepth, OdGiRasterImage.Units units)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiRasterImageDesc_createObject__SWIG_6(pixelWidth, pixelHeight, colorDepth, (int)units);
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiRasterImage createObject(uint pixelWidth, uint pixelHeight, uint colorDepth)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiRasterImageDesc_createObject__SWIG_7(pixelWidth, pixelHeight, colorDepth);
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiRasterImage createObject(OdGiRasterImage pSourceImage)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiRasterImageDesc_createObject__SWIG_8(OdGiRasterImage.getCPtr(pSourceImage));
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setFrom(OdGiRasterImage pSourceImage)
		{
			GlobalsPINVOKE.OdGiRasterImageDesc_setFrom(this.swigCPtr, OdGiRasterImage.getCPtr(pSourceImage));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdRxObject clone()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiRasterImageDesc_clone(this.swigCPtr);
			OdRxObject result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void copyFrom(OdRxObject pSource)
		{
			GlobalsPINVOKE.OdGiRasterImageDesc_copyFrom(this.swigCPtr, OdRxObject.getCPtr(pSource));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual uint pixelWidth()
		{
			uint result = GlobalsPINVOKE.OdGiRasterImageDesc_pixelWidth(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual uint pixelHeight()
		{
			uint result = GlobalsPINVOKE.OdGiRasterImageDesc_pixelHeight(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual uint colorDepth()
		{
			uint result = GlobalsPINVOKE.OdGiRasterImageDesc_colorDepth(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual uint numColors()
		{
			uint result = GlobalsPINVOKE.OdGiRasterImageDesc_numColors(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual uint color(uint colorIndex)
		{
			uint result = GlobalsPINVOKE.OdGiRasterImageDesc_color(this.swigCPtr, colorIndex);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual uint paletteDataSize()
		{
			uint result = GlobalsPINVOKE.OdGiRasterImageDesc_paletteDataSize(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void paletteData(byte[] bytes)
		{
			GlobalsPINVOKE.OdGiRasterImageDesc_paletteData(this.swigCPtr, Teigha.Core.Helpers.MarshalbyteFixedArray(bytes));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual uint scanLineSize()
		{
			uint result = GlobalsPINVOKE.OdGiRasterImageDesc_scanLineSize(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual byte[] scanLines()
		{
			byte[] result = Teigha.Core.Helpers.UnMarshalbyteFixedArray(GlobalsPINVOKE.OdGiRasterImageDesc_scanLines__SWIG_0(this.swigCPtr));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void scanLines(ref byte[] scnLines, uint firstScanline, uint numLines)
		{
			IntPtr intPtr = Teigha.Core.Helpers.MarshalbyteFixedArray(scnLines);
			try
			{
				GlobalsPINVOKE.OdGiRasterImageDesc_scanLines__SWIG_1(this.swigCPtr, intPtr, firstScanline, numLines);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
			finally
			{
				scnLines = Teigha.Core.Helpers.UnMarshalbyteFixedArray(intPtr);
				Marshal.FreeCoTaskMem(intPtr);
			}
		}

		public new virtual void scanLines(ref byte[] scnLines, uint firstScanline)
		{
			IntPtr intPtr = Teigha.Core.Helpers.MarshalbyteFixedArray(scnLines);
			try
			{
				GlobalsPINVOKE.OdGiRasterImageDesc_scanLines__SWIG_2(this.swigCPtr, intPtr, firstScanline);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
			finally
			{
				scnLines = Teigha.Core.Helpers.UnMarshalbyteFixedArray(intPtr);
				Marshal.FreeCoTaskMem(intPtr);
			}
		}

		public new virtual OdGiRasterImage.PixelFormatInfo pixelFormat()
		{
			OdGiRasterImage.PixelFormatInfo result = new OdGiRasterImage.PixelFormatInfo(GlobalsPINVOKE.OdGiRasterImageDesc_pixelFormat__SWIG_0(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual uint scanLinesAlignment()
		{
			uint result = GlobalsPINVOKE.OdGiRasterImageDesc_scanLinesAlignment(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdGiRasterImage.Units defaultResolution(out double xPelsPerUnit, out double yPelsPerUnit)
		{
			OdGiRasterImage.Units result = (OdGiRasterImage.Units)GlobalsPINVOKE.OdGiRasterImageDesc_defaultResolution(this.swigCPtr, out xPelsPerUnit, out yPelsPerUnit);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setPixelWidth(uint pixelWidth)
		{
			GlobalsPINVOKE.OdGiRasterImageDesc_setPixelWidth(this.swigCPtr, pixelWidth);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setPixelHeight(uint pixelHeight)
		{
			GlobalsPINVOKE.OdGiRasterImageDesc_setPixelHeight(this.swigCPtr, pixelHeight);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setColorDepth(uint colorDepth)
		{
			GlobalsPINVOKE.OdGiRasterImageDesc_setColorDepth(this.swigCPtr, colorDepth);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setPalette(uint paletteSize, byte[] paletteData)
		{
			GlobalsPINVOKE.OdGiRasterImageDesc_setPalette(this.swigCPtr, paletteSize, Teigha.Core.Helpers.MarshalbyteFixedArray(paletteData));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setScanLinesAlignment(uint alignment)
		{
			GlobalsPINVOKE.OdGiRasterImageDesc_setScanLinesAlignment(this.swigCPtr, alignment);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefaultResolution(OdGiRasterImage.Units units, double xPelsPerUnit, double yPelsPerUnit)
		{
			GlobalsPINVOKE.OdGiRasterImageDesc_setDefaultResolution(this.swigCPtr, (int)units, xPelsPerUnit, yPelsPerUnit);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual uint supportedParams()
		{
			uint result = GlobalsPINVOKE.OdGiRasterImageDesc_supportedParams(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdGiRasterImage.ImageSource imageSource()
		{
			OdGiRasterImage.ImageSource result = (OdGiRasterImage.ImageSource)GlobalsPINVOKE.OdGiRasterImageDesc_imageSource(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void setImageSource(OdGiRasterImage.ImageSource source)
		{
			GlobalsPINVOKE.OdGiRasterImageDesc_setImageSource(this.swigCPtr, (int)source);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdGiRasterImage.TransparencyMode transparencyMode()
		{
			OdGiRasterImage.TransparencyMode result = (OdGiRasterImage.TransparencyMode)GlobalsPINVOKE.OdGiRasterImageDesc_transparencyMode(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void setTransparencyMode(OdGiRasterImage.TransparencyMode mode)
		{
			GlobalsPINVOKE.OdGiRasterImageDesc_setTransparencyMode(this.swigCPtr, (int)mode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
